import { h } from 'vue';
import { NAvatar, NTag } from 'naive-ui';

export const columns = [
  {
    title: 'id',
    key: 'id',
    width: 100,
  },
  {
    title: '账户',
    key: 'username',
    width: 100,
  },
  {
    title: '手机号',
    key: 'phone',
    width: 100,
  },
  {
    title: '头像',
    key: 'avatar',
    width: 100,
    render(row) {
      return h(NAvatar, {
        size: 48,
        src: row.avatar,
      });
    },
  },
  {
    title: '是否禁用',
    key: 'lockFlag',
    render(row) {
      return h(
        NTag,
        {
          type: row.lockFlag == '0' ? 'success' : 'error',
        },
        {
          default: () => (row.lockFlag == '0' ? '正常' : '其他'),
        }
      );
    },
  },
  {
    title: '创建日期',
    key: 'createTime',
    width: 160,
  },
  {
    title: '修改时间',
    key: 'updateTime',
    width: 160,
  },
];
